#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Time: 2019/6/2  10:17
# @Author: 余浪人
# @email: yulangren520@gmail.com
from apps.lib.public import random_click, spider_add_data



def save_data(title, superior: int, content=None, download1=None, download2=None, thumb_img=None, clicks=None,
              author=None, keyword=None, description=None, source=None, promulgator=None, contributor=None,
              permissions=None, is_focus=None, is_roll=None, is_roll_text=None, is_index_stick=None,
              is_list_stick=None, is_recommend=None, is_pass=None, weight=random_click()):
    data = {"title": title, "superior": superior, "content": content, "download1": download1,
            "download2": download2, "thumb_img": thumb_img, "clicks": clicks, "author": author,
            "keyword": keyword, "description": description, "source": source,
            "promulgator": promulgator, "contributor": contributor, "permissions": permissions,
            "is_focus": is_focus, "is_roll": is_roll, "is_roll_text": is_roll_text,
            "is_index_stick": is_index_stick, "is_list_stick": is_list_stick,
            "is_recommend": is_recommend, "is_pass": is_pass, "weight": weight}

    try:
        res = spider_add_data(data)
        if res:return res  # "采集成功"
    except:
        print('采集失败')
